package com.ubxtech.balance.rule;

import org.springframework.cloud.client.ServiceInstance;

import java.util.List;

/**
 * websocket的转发规则
 * @author Victor.Xiao
 * @since 2023-12-09 11:07
 **/
public interface WebSocketLoadBalancerRule {
    /**
     * 根据websocket挑选对应的服务
     * @author Victor.Xiao
     * @since 2023-12-09 14:12
     * @param hasVersionInstancesFilter 匹配版本号成功的服务
     * @param emptyVersionInstancesFilter 没有配置版本号的服务
     * @param allInstances 所有服务
     * @param userId userId
     * @param token token
     * @return org.springframework.cloud.client.ServiceInstance
    */
    ServiceInstance choose(List<ServiceInstance> hasVersionInstancesFilter, List<ServiceInstance> emptyVersionInstancesFilter, List<ServiceInstance> allInstances, String userId, String token);
}
